 1 REM*** PAUL A. JOVIAK ***
 2 REM*****  POKER  ********
 3 REM * 8K IP PROGRAM *
 4 TT=200
 5 POKE530,1
 10 A1=2:A2=0:A3=0
 12 PRINT:PRINT
 13 PRINT"INSTRUCTIONS:":GOSUB9000
 20 POKE54068,A1+48:POKE54069,A2+48:POKE54070,A3+48
 22 G=54053:L$="YOU NOW HAVE $":GOSUB8000
 23 PRINT"READY ?":F=0:F1=0
 24 POKE57088,239:F=PEEK(57088):POKE57088,251
 25 F1=PEEK(57088):IFF=0ANDF1=0THEN24
 26 IFF1=247ANDTT=200ANDA1=2ANDA2=0ANDA3=0THEN12
 27 IFF1=247THEN950
 28 IFF=247THEN30
 29 GOTO24
 30 CLEAR
 35 A1=PEEK(54036)-48:A2=PEEK(54037)-48:A3=PEEK(54038)-48
 36 TT=A1*100+A2*10+A3
 37 RS=RND(RND(TT))
 38 FORI=1TO32:PRINT:NEXT
 40 P$="                         "
 42 SP=1:SD=1
 45 DIMM(13)
 50 DIMC(4,13):DIMS(4):DIMN(13)
 55 DIMV(2,5):DIMP(2,5):DIMD(2,5)
 60 FORI=1TO4:FORJ=1TO13:C(I,J)=0:NEXTJ,I
 70 FORI=2TO9:N(I)=48+I:NEXT:N(10)=84:N(1)=65:N(11)=74:N(12)=81
 75 N(13)=75
 80 FORI=1TO4:S(I)=228+I:NEXT
 90 FORI=1TO5:V(1,I)=64:V(2,I)=32:NEXTI
 140 FORK=1TO2:FORX=1TO5
 150 GOSUB1000
 160 IFK=2THEN180
 170 P(1,X)=N(N):P(2,X)=S(S):R(X)=N:GOTO190
 180 D(1,X)=N(N):D(2,X)=S(S)
 185 W(X)=N:B(X)=N
 190 NEXTX,K
 200 FORI=0TO20STEP5:FORJ=0TO2
 210 POKE53573+I+J,144:POKE53765+I+J,145
 220 POKE54021+I+J,145:POKE53829+I+J,144
 230 NEXTJ,I
 240 FORI=0TO256STEP256:FORJ=0TO128STEP32
 250 FORX=4TO24STEP5:POKE53604+I+J+X,146:NEXTX
 260 FORX=0TO20STEP5:POKE53604+I+J+X,147:NEXT
 270 NEXTJ,I
 280 GOSUB2000
 290 L$="HOW MANY CARDS DO":G=53477:GOSUB8000
 292 L$="YOU WISH ?":G=53541:GOSUB8000:G=53477
 300 POKE57088,127:F=PEEK(57088):R=0
 310 IFF=127THENR=1
 320 IFF=191THENR=2
 330 IFF=223THENR=3
 340 IFF=255THEN300
 350 IFR=0THEN410
 355 L$=P$:GOSUB8000
 357 G=53541:GOSUB8000:G=53477
 360 FORH=1TOR:L$="CARD":POKE53483,H+48
 363 QC=127
 365 GOSUB8000:Q=128:FORJ=1TO5:F=0
 370 POKE57088,127:F=PEEK(57088):IFF=255THEN370
 390 IFF=QCTHENGOSUB1000:P(1,J)=N(N):P(2,J)=S(S):R(J)=N
 400 Q=Q-Q/2:QC=QC+Q:NEXTJ:L$=P$:GOSUB8000:NEXTH
 410 L$=P$:GOSUB8000:G=53541:GOSUB8000:G=53477
 413 GOSUB2000:GOSUB5000
 415 GOSUB6900:GOSUB5000
 420 HD=HC:DW=W:DY=Y:DR=PR:DT=TR:DF=FR:T1=E1:T2=E2
 425 L$=P$:GOSUB8000
 430 GOSUB3000
 440 L$=P$:G=53541:GOSUB8000:G=53477
 450 GOSUB8000
 600 FORI=1TO5:W(I)=R(I):FORJ=1TO2:D(J,I)=P(J,I):NEXTJ,I
 610 GOSUB5010
 620 L$=P$:GOSUB8000
 890 GOSUB4000
 895 IFL$="I FOLD"THEN920
 900 GOSUB2000
 920 IFL$="I WIN"ORL$=P$THENTW=SP:Z$="YOU LOST $"
 930 IFL$="YOU WIN"ORL$="I FOLD"THENTW=SD:Z$="YOU WON $"
 940 PRINTZ$;TW
 941 IFL$="I WIN"ORL$=P$THENTW=-TW
 943 TT=TT+TW
 945 A1=INT(TT/100):A2=INT((TT-A1*100)/10):A3=INT(TT-A1*100-A2*10)
 948 IFTT>=500ORTT=<0THEN950
 949 GOTO20
 950 PRINT:IFTT>200THENPW=TT-200:PRINT"CONGRATULATIONS ,YOU WON $";PW
 953 PRINT:IFTT<200THENPW=200-TT:PRINT"SORRY ,YOU LOST $";PW
 955 PRINT:IFTT=200THENPRINT"YOU BROKE EVEN"
 957 PRINT"THE CASHIER IS UP FRONT":PRINT:TT=200
 959 INPUT"PLAY AGAIN";A$
 960 IFLEFT$(A$,1)="Y"THEN5
 995 GOTO49999
 1000 S=INT(4*RND(RS)+1):N=INT(13*RND(RS)+1)
 1010 IFC(S,N)=1THEN1000
 1020 IFC(S,N)=0THENC(S,N)=1
 1030 RETURN
 2000 K=0:FORX=0TO20STEP5:K=K+1
 2010 POKE53670+X,P(1,K):POKE53605+X,P(2,K):POKE53735+X,P(2,K)
 2020 POKE53926+X,V(1,K):POKE53861+X,V(2,K):POKE53991+X,V(2,K)
 2030 NEXTX:RETURN
 3000 L$="WHAT IS YOUR BET":GOSUB8000
 3020 L$="IN DOLLARS ($7 MAX.)?":G=53541:GOSUB8000
 3030 G=53477
 3031 GOTO3035
 3033 L$="RAISE ME BY HOW MUCH ?                     ":GOSUB8000
 3034 SP=SD
 3035 F=0:F1=0
 3040 POKE57088,127:F=PEEK(57088):POKE57088,191:F1=PEEK(57088)
 3045 IFF=255ANDF1=255THEN3040
 3046 IFF1<>255THEN3990
 3050 Q=127:QC=128:FORI=1TO7:IFF=QTHENQ1=I
 3055 QC=QC-QC/2:Q=Q+QC
 3060 NEXT:L$=P$:GOSUB8000:SP=SP+Q1
 3062 G=53541:GOSUB8000:G=53477
 3065 IFW=0THEN3990
 3070 L$="I CALL YOUR $":GOSUB8000:G=53492:L$=CHR$(Q1+48):GOSUB8000
 3072 G=53477
 3075 FORI=1TO2000:NEXT:L$=P$:GOSUB8000
 3080 G=53477:U=INT(7*RND(F))
 3082 IFSD>10ANDW<3THENU=0
 3083 IFSD>20ANDW<6THENU=0
 3084 SD=SD+Q1+U
 3085 IFU=0THEN3990
 3090 L$="I RAISE YOU $":GOSUB8000:G=53492:L$=CHR$(U+48):GOSUB8000
 3095 FORI=1TO1500:NEXT
 3097 L$=P$:G=53477:GOSUB8000
 3100 G=53477:L$="CALL ,FOLD":GOSUB8000
 3103 L$="OR INCREASE BET":G=53541:GOSUB8000:G=53477
 3105 F=0:F1=0:F2=0
 3110 POKE57088,251:F1=PEEK(57088):POKE57088,247:F=PEEK(57088)
 3115 POKE57088,239:F2=PEEK(57088)
 3120 IFF=255ANDF1=255ANDF2=255THEN3110
 3125 L$=P$:GOSUB8000
 3126 G=53541:GOSUB8000:G=53477
 3130 IFF=223THENL$="I WIN":GOSUB8000:GOTO920
 3140 IFF2=253THEN3033
 3150 SP=SD
 3990 RETURN
 4000 IFW=1THENKO=1
 4010 IFW=2THENKO=2
 4020 IFW=3THENKO=3
 4030 IFW=4THENKO=6.5
 4040 IFY=5THENKO=5
 4050 IFW=7THENKO=6
 4060 IFW=6THENKO=7
 4070 IFY=5ANDW=7THENKO=8
 4080 IFDW=1THENKD=1
 4090 IFDW=2THENKD=2
 4100 IFDW=3THENKD=3
 4110 IFDW=4THENKD=6.5
 4120 IFDY=5THENKD=5
 4130 IFDW=7THENKD=6
 4240 IFDW=6THENKD=7
 4250 IFDY=5ANDDW=7THENKD=8
 4300 IFKO>KDTHENL$="YOU WIN"
 4310 IFKD>KOTHENL$="I WIN"
 4320 IFKD=0THENL$="I FOLD"
 4330 IFKD=0THEN4890
 4400 IFKD<>KOTHEN4890
 4410 IFKO=2ORKD=2THEN4460
 4420 IFE1>T1ORDT<TRORFR>DFTHENZ=1
 4425 IFT1>E1ORDT>TRORDF>FRTHENZ=0
 4430 IFE1=1ORTR=1ORFR=1ANDT1<>1ANDDT<>1ANDDF<>1THENZ=1
 4435 IFT1=1ORDT=1ORDF=1ANDE1<>1ANDTR<>1ANDFR<>1THENZ=0
 4440 IFT1<>E1ORDT<>TRORDF<>FRTHEN4460
 4450 IFHC>HDTHENZ=1
 4455 IFHD>HCTHENZ=0
 4456 IFHC=1THENZ=1
 4457 IFHD=1THENZ=0
 4460 IFE2=0THEN4530
 4465 IFE2>T1ANDE2>T2THENZ=1
 4470 IFE1>T1ANDE1>T2THENZ=1
 4475 IFE1=T1ANDE2>T2THENZ=1
 4480 IFE2=T1ANDE1>T2THENZ=1
 4485 IFE1=T2ANDE2>T1THENZ=1
 4490 IFE2=T2ANDE1>T1THENZ=1
 4500 IFE1=1ORE2=1ANDT1<>1ANDT2<>1THENZ=1
 4510 IFT1=1ORT2=1ANDE1<>1ANDE2<>1THENZ=0
 4515 IFT2<>E1ANDT1<>E1THEN4530
 4516 IFT2<>E2ANDT1<>E2THEN4530
 4520 IFHC>HDTHENZ=1
 4525 IFHD>HCTHENZ=0
 4530 IFKO<>5ORKO<>6ORKO<>7ORKO<>8THEN4880
 4540 IFHC>HDTHENZ=1
 4550 IFHD>HCTHENZ=0
 4880 IFZ=1THENL$="YOU WIN"
 4885 IFZ=0THENL$="I WIN"
 4890 GOSUB8000
 4900 RETURN
 5000 FORI=1TO2:FORJ=1TO5:V(I,J)=D(I,J):NEXTJ,I
 5005 L$="THE ANTE IS $1.00":GOSUB8000
 5010 W=0:FORI=1TO4:FORJ=I+1TO5
 5020 IFD(1,I)=D(1,J)THENW=W+1
 5030 NEXTJ,I
 5040 A=0:FORI=1TO4
 5050 IFD(2,I)=D(2,I+1)THENA=A+1
 5060 NEXTI:IFA=4THENW=7
 5080 FORK=1TO5:FORI=1TO4:FORJ=I+1TO5:IFW(I)<W(I+1)THEN5110
 5100 W(6)=W(I):W(I)=W(I+1):W(I+1)=W(6)
 5110 NEXTJ,I,K:Y=0
 5120 A=0:FORI=1TO4:IFW(I)+1=W(I+1)THENA=A+1
 5130 NEXTI:IFA=4THENY=5
 5140 IFW(1)=1ANDW(2)=10ANDW(3)=11ANDW(4)=12ANDW(5)=13THENY=5
 5150 HC=W(5):IFW(1)=1THENHC=1
 5155 FORI=1TO13:M(I)=0:NEXT:PR=0:TR=0:FR=0
 5156 E1=0:E2=0
 5160 FORI=1TO5:FORJ=1TO13:IFW(I)=JTHENM(J)=M(J)+1
 5170 NEXTJ,I:FORI=1TO13:IFM(I)=2THENPR=PR+1
 5175 IFM(I)=2ANDPR=1THENE1=I
 5176 IFM(I)=2ANDPR=2THENE2=I
 5180 IFM(I)=3THENTR=I
 5190 IFM(I)=4THENFR=I
 5200 NEXTI
 5500 IFW=1ANDW(5)=E1THENHC=W(4)
 5510 IFW=1ANDW(4)=E1THENHC=W(3)
 6000 RETURN
 6900 IFY=5ORW=7THENRETURN
 6950 G1=5:IFW=0THENG1=3
 7000 FORI=1TOG1
 7010 IFE1=B(I)ORE2=B(I)ORTR=B(I)ORFR=B(I)THEN7100
 7020 GOSUB1000:D(1,I)=N(N):D(2,I)=S(S):B(I)=N
 7100 NEXTI
 7120 FORI=1TO5:W(I)=B(I):NEXT
 7200 RETURN
 8000 FORI=1TOLEN(L$):POKEG+I,ASC(MID$(L$,I,1)):NEXT:RETURN
 9000 PRINT"WHEN THE CARDS APPEAR":PRINT"ON THE SCREEN,YOU"
 9005 PRINT"WILL BE ASKED 'HOW":PRINT"MANY CARDS DO YOU"
 9010 PRINT"WISH ?'. THE GAME IS":PRINT"3 CARD DRAW POKER AND"
 9020 PRINT"IF '4' IS PRESSED NO":PRINT"CARDS ARE DRAWN. IF"
 9025 PRINT"YOU DRAW 'CARD 1' WILL":PRINT"APPEAR. YOU WILL THEN"
 9030 PRINT"ANSWER A NUMBER BETWEEN":PRINT"1 AND 5 INDICATING"
 9035 PRINT"THE CARD YOU WISH TO":PRINT"REPLACE. ANTE IS"
 9040 PRINT"ALWAYS $1.00. BETS AND":PRINT"RAISES CAN BE NO MORE"
 9050 PRINT"THAN $7.00 AT A TIME."
 9060 PRINT"YOU ARE PLAYING TO":PRINT"$500 OR NOTHING."
 9070 PRINT"GOOD LUCK !!"
 9080 PRINT
 9090 PRINT
 9900 RETURN
 49999 END
